<template>
  <div class="son">
    <h3>我是son组件,{{ car.name }}</h3>
  </div>
</template>

<script>
import { inject } from "vue";
export default {
  name: "Son",
  setup(props) {
    let car = inject("car");
    console.log(car);
    return {
      car,
    };
  },
};
</script>

<style>
.son {
  background-color: silver;
  padding: 10px;
}
</style>